import sys
sys.path.insert(0, "/home/lighthouse/my-dream")
import middle_script

def zhi_entran():
    from entrance import main_entran
    print("1. 主页经典话题\n2. 热点话题\n3. 获取知乎日报\n4. 获取热门消息")
    branch_hu = input("请选择您要进行预览的知乎新闻")
    # 当用户选择的是主页经典话题时
    if branch_hu == "1":
        result = middle_script.hu().get_answer()
        # 将程序不停止，询问客户下一步操作
        wait = input("返回主菜单/退出程序(y/n)")
        if wait == "n":
            sys.exit(0)
        elif wait == "y":
            main_entran()
    # 当用户选择的是获取实时热点话题时
    elif branch_hu == "2":
        result = middle_script.hu().get_cn_api()
        wait = input("返回主菜单/退出程序(y/n)")
        if wait == "n":
            sys.exit(0)
        elif wait == "y":
            main_entran()
    # 当用户选择的是获取知乎日报时
    elif branch_hu == "3":
        result = middle_script.hu().get_newest_news()
        wait = input("返回主菜单/退出程序(y/n)")
        if wait == "n":
            sys.exit(0)
        elif wait == "y":
            main_entran()
    # 当用户选择的是获取热门消息时
    elif branch_hu == "4":
        result = middle_script.hu().get_hot_news()
        wait = input("返回主菜单/退出程序(y/n)")
        if wait == "n":
            sys.exit(0)
        elif wait == "y":
            main_entran()
    else:
        print("请输入正确的值")
        zhi_entran()